package main

import (
	"algorithms/queue"
	"algorithms/stack"
	"fmt"
)

func main() {
	s := stack.MakeArrayStack[Integer]()
	for i := 0; i < 10; i++ {
		//变量，需手动装箱
		s.Push(Integer(i))
	}
	fmt.Println(s)
	e, _ := s.Pop()
	fmt.Println(e)
	s1 := stack.MakeArrayStack[student]()
	s1.Push(student{name: "Alice", score: 98})
	s1.Push(student{name: "Bobo", score: 100})
	s1.Push(student{name: "Charles", score: 66})
	fmt.Println(s1)

	q := queue.MakeArrayQueue[Integer]()
	for i := 0; i < 10; i++ {
		//变量，需手动装箱
		q.Enqueue(Integer(i))
		fmt.Println(q)
		if i%3 == 2 {
			q.DeEnqueue()
			fmt.Println(q)
		}

	}
	fmt.Println("--------------------------------")
	q1 := queue.MakeLoopQueue[Integer]()
	for i := 0; i < 10; i++ {
		//变量，需手动装箱
		q1.Enqueue(Integer(i))
		fmt.Println(q1)
		if i%3 == 2 {
			q1.DeEnqueue()
			fmt.Println(q1)
		}
	}
	fmt.Println("--------------------------------")
	q2 := queue.MakeDeque[Integer]()
	for i := 0; i < 10; i++ {
		//变量，需手动装箱
		if i%2 == 0 {
			q2.AddLast(Integer(i))
			v, _ := q2.GetLast()
			fmt.Println(q2)
			fmt.Println(v)
		} else {
			q2.AddFront(Integer(i))
			v, _ := q2.GetFront()
			fmt.Println(q2)
			fmt.Println(v)
		}
		if i%3 == 2 {
			q2.RemoveFront()
			fmt.Println(q2)
		}
	}
}
